package com.eric.demo.validate;

import java.util.Date;

/**
 * @author ZhangGuangyin on 2018/8/20
 */
public class TestMain {

    public static void main(String[] argvs){
        User u1 = new User();
        ValidationResult result1 = ValidateUtils.validateEntity(u1);
        System.out.println("isError: " +result1.isHasErrors());
        System.out.println(result1.getErrorMsg());
        System.out.println("----------------------");

        u1.setAge(17);
        u1.setName("aaaa");
        result1 = ValidateUtils.validateEntity(u1);
        System.out.println("isError: " +result1.isHasErrors());
        System.out.println(result1.getErrorMsg());
        System.out.println("----------------------");

        u1.setAge(19);
        u1.setBirthday(new Date(System.currentTimeMillis() -100));
        result1 = ValidateUtils.validateEntity(u1);
        System.out.println("isError: " +result1.isHasErrors());
        System.out.println(result1.getErrorMsg());
        System.out.println("----------------------");
    }
}
